<template>
  <div>
  <el-form :model="saveForm" label-width="80px" ref="saveForm">
    <el-form-item label="上级部门">
      <!--Cascader 级联选择器 无限级树
       :options="deptTree"-级联框 需要显示的数据
       :props  显示的数据设置
       -->
      <el-cascader v-model="saveForm.parent_id"
                   :options="deptTree"
                   :props="{
                checkStrictly: true,
                label:'name',//框框 显示的内容
                value:'id' // 提交时，提交的内容
              }"
                   clearable></el-cascader>
    </el-form-item>
  </el-form>
  {{saveForm.parent_id}}
  </div>
</template>

<script>
export default {
  name: "Test",
  data(){
    return{
      saveForm:{
        parent_id:[1,13,30]
      },
      deptTree:[{"id":1,"sn":"dept1","name":"部门1","dirPath":"/1","state":1,"manager_id":324,"parent_id":null,"manager":null,"parent":null,"children":[{"id":13,"sn":"dept13","name":"部门13","dirPath":"/1/13","state":1,"manager_id":327,"parent_id":1,"manager":null,"parent":null,"children":[{"id":30,"sn":"ylxxb","name":"娱乐休闲部","dirPath":"/1/13/30","state":1,"manager_id":327,"parent_id":13,"manager":null,"parent":null}]},{"id":14,"sn":"dept14","name":"部门14","dirPath":"/1/14","state":0,"manager_id":326,"parent_id":1,"manager":null,"parent":null}]},{"id":2,"sn":"dept2","name":"部门2","dirPath":"/2","state":1,"manager_id":325,"parent_id":null,"manager":null,"parent":null,"children":[{"id":5,"sn":"dept5","name":"部门5","dirPath":"/2/5","state":1,"manager_id":327,"parent_id":2,"manager":null,"parent":null,"children":[{"id":6,"sn":"dept6","name":"部门6","dirPath":"/2/5/6","state":1,"manager_id":327,"parent_id":5,"manager":null,"parent":null},{"id":10,"sn":"dept10","name":"部门10","dirPath":"/2/5/10","state":0,"manager_id":324,"parent_id":5,"manager":null,"parent":null}]},{"id":7,"sn":"dept7","name":"部门7","dirPath":"/2/7","state":1,"manager_id":324,"parent_id":2,"manager":null,"parent":null,"children":[{"id":17,"sn":"dept17","name":"部门17","dirPath":"/2/7/17","state":1,"manager_id":324,"parent_id":7,"manager":null,"parent":null},{"id":18,"sn":"dept18","name":"部门18","dirPath":"/2/7/18","state":0,"manager_id":325,"parent_id":7,"manager":null,"parent":null,"children":[{"id":23,"sn":"dept23","name":"部门23","dirPath":"/2/7/18/23","state":1,"manager_id":326,"parent_id":18,"manager":null,"parent":null}]}]}]},{"id":3,"sn":"dept3","name":"部门3","dirPath":"/3","state":0,"manager_id":351,"parent_id":null,"manager":null,"parent":null,"children":[{"id":8,"sn":"dept8","name":"部门8","dirPath":"/3/8","state":1,"manager_id":326,"parent_id":3,"manager":null,"parent":null,"children":[{"id":19,"sn":"dept19","name":"部门19","dirPath":"/3/8/19","state":1,"manager_id":327,"parent_id":8,"manager":null,"parent":null},{"id":20,"sn":"dept20","name":"部门20","dirPath":"/3/8/20","state":1,"manager_id":326,"parent_id":8,"manager":null,"parent":null,"children":[{"id":21,"sn":"dept21","name":"部门21","dirPath":"/3/8/20/21","state":1,"manager_id":327,"parent_id":20,"manager":null,"parent":null},{"id":22,"sn":"dept22","name":"部门22","dirPath":"/3/8/20/22","state":1,"manager_id":326,"parent_id":20,"manager":null,"parent":null}]}]},{"id":9,"sn":"dept9","name":"部门9","dirPath":"/3/9","state":1,"manager_id":325,"parent_id":3,"manager":null,"parent":null,"children":[{"id":11,"sn":"dept11","name":"部门11","dirPath":"/3/9/11","state":1,"manager_id":351,"parent_id":9,"manager":null,"parent":null},{"id":12,"sn":"dept12","name":"部门12","dirPath":"/3/9/12","state":1,"manager_id":326,"parent_id":9,"manager":null,"parent":null}]}]},{"id":4,"sn":"dept4","name":"部门4","dirPath":"/4","state":1,"manager_id":326,"parent_id":null,"manager":null,"parent":null,"children":[{"id":15,"sn":"dept15","name":"部门15","dirPath":"/4/15","state":1,"manager_id":326,"parent_id":4,"manager":null,"parent":null},{"id":16,"sn":"dept16","name":"部门16","dirPath":"/4/16","state":0,"manager_id":324,"parent_id":4,"manager":null,"parent":null}]}]
    }
  }
}
</script>

<style scoped>

</style>